home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Freeware / Griffith 0.9.8 / griffith-0.9.8-win32.exe / {app} / lib / plugins / movie / PluginMovieMoviefone.py < prev    next >
Text File  |  2008-11-17  |  3KB  |  100 lines

  1. # -*- coding: UTF-8 -*-
  2.  
  3. # $Id: PluginMovieMoviefone.py 1040 2008-11-15 21:13:49Z mikej06 $
  4.  
  5. # Copyright (c) 2005-2007 Vasco Nunes
  6. # You may use and distribute this software under the terms of the
  7. # GNU General Public License, version 2 or later
  8.  
  9. import gutils
  10. import movie,string
  11.  
  12. plugin_name = "Moviefone"
  13. plugin_description = "A Service of America Online"
  14. plugin_url = "movies.aol.com"
  15. plugin_language = _("English")
  16. plugin_author = "Vasco Nunes"
  17. plugin_version = "0.3"
  18.  
  19. class Plugin(movie.Movie):
  20.     def __init__(self, id):
  21.         self.movie_id = id
  22.         self.url = "http://movies.aol.com/movie/main.adp?_pgtyp=pdct&mid=" + str(self.movie_id)
  23.  
  24.     def get_image(self):
  25.         self.image_url = gutils.trim(self.page,"http://cdn.channel.aol.com/amgvideo/dvd/cov150/",".jpg")
  26.         self.image_url = "http://cdn.channel.aol.com/amgvideo/dvd/cov150/" + self.image_url + ".jpg"
  27.  
  28.     def get_o_title(self):
  29.         self.o_title = string.capwords(gutils.trim(self.page,"<title>"," - Moviefone</title>") )
  30.  
  31.     def get_title(self):
  32.         self.title = self.o_title
  33.  
  34.     def get_director(self):
  35.         self.director = gutils.trim(self.page,"<strong>Directed By:</strong> ","<br />")
  36.         self.director = string.strip(gutils.strip_tags(self.director))
  37.  
  38.     def get_plot(self):
  39.         self.plot = gutils.trim(self.page,"<strong>Synopsis:</strong> ","<br />")
  40.         self.plot = string.strip(gutils.strip_tags(self.plot))
  41.  
  42.     def get_year(self):
  43.         self.year = gutils.trim(self.page,"<strong>DVD Release Date:</strong> ","<br />")
  44.         self.year = self.year[-4:]
  45.  
  46.     def get_runtime(self):
  47.         self.runtime = gutils.trim(self.page,"<strong>Run Time:</strong> "," min.<br />")
  48.  
  49.     def get_genre(self):
  50.         self.genre = gutils.trim(self.page,"<strong>Genre:</strong> ","<br />")
  51.  
  52.     def get_cast(self):
  53.         self.cast = gutils.trim(self.page,"<strong>Starring:</strong> ","<br />")
  54.         self.cast = string.strip(gutils.strip_tags(self.cast))
  55.  
  56.     def get_classification(self):
  57.         self.classification = gutils.trim(self.page,"<strong>Rating:</strong> ","<br />")
  58.  
  59.     def get_studio(self):
  60.         self.studio = gutils.trim(self.page,"<strong>Released By:</strong> ","<br />")
  61.  
  62.     def get_o_site(self):
  63.         self.o_site = ""
  64.  
  65.     def get_site(self):
  66.         self.site = ""
  67.  
  68.     def get_trailer(self):
  69.         self.trailer = gutils.trim(self.page,"""onclick="setTrailerOmni();window.open('""", \
  70.             "','_dlplayer'")
  71.  
  72.     def get_country(self):
  73.         self.country = ""
  74.  
  75.     def get_rating(self):
  76.         self.rating = "0"
  77.  
  78. class SearchPlugin(movie.SearchMovie):
  79.     def __init__(self):
  80.         self.original_url_search    = "http://movies.aol.com/search/encyresults.adp?query=";
  81.         self.translated_url_search    = "http://movies.aol.com/search/encyresults.adp?query=";
  82.  
  83.     def search(self,parent_window):
  84.         self.open_search(parent_window)
  85.         self.sub_search()
  86.         return self.page
  87.  
  88.     def sub_search(self):
  89.         self.page = gutils.trim(self.page,"--start LT_MultiColumn_1.0 module-->", 'pagnationleft">Results   ')
  90.  
  91.     def get_searches(self):
  92.         elements = string.split(self.page,'class="dvdtitle">')
  93.         elements[0] = ''
  94.  
  95.         for element in elements:
  96.             element = gutils.trim( element, '<a href="', '<br/>' )
  97.             if element != '':
  98.                 self.ids.append( gutils.after( gutils.trim( element, 'movie/','/main') , '/' ) )
  99.                 self.titles.append( string.replace( gutils.after( element, '">' ), '</a></span>', '' ) )
  100.